#define _GNU_SOURCE
#include "app_pool.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

/**
 * @brief  定义任务函数
 */
void *task_func(void *arg)
{
    sleep(1);
    printf("task_func %d\n", gettid());
    return NULL;
}

int main(int argc, char const *argv[])
{
    // 1.初始化线程池
    app_pool_init();
    // 2.提交任务
    app_pool_submit_task(task_func, NULL);
    app_pool_submit_task(task_func, NULL);
    app_pool_submit_task(task_func, NULL);
    app_pool_submit_task(task_func, NULL);
    app_pool_submit_task(task_func, NULL);
    app_pool_submit_task(task_func, NULL);
    // 3.sleep
    sleep(10);
    // 4.销毁线程池
    app_pool_destroy();
    return 0;
}
